package utils

import (
	"fmt"
	"time"
)

//获取今日0点时间戳
func GetTodayZeroTimestamp() int {
	t := time.Now()
	tm1 := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
	return int(tm1.Unix())
}

func FormatTime(sec int) string {
	h := sec / (60 * 60)
	m := sec % (60 * 60) / 60
	return fmt.Sprintf("%d:%d", h, m)
}

func FormatDate(timestamp int64) string {
	t := time.Unix(timestamp, 0)
	return fmt.Sprintf("%d-%d-%d", t.Year(), t.Month(), t.Day())

}
